--我见犹怜
local wojianyoulian = fk.CreateSkill {
    name = "mcdh_wojianyoulian",
}

local U = require "packages/utility/utility"
local lib = require "packages/mcdh/lib"

wojianyoulian:addEffect(fk.EnterDying,{
    can_trigger = function(self, event, target, player, data)
        return target == player and player:hasSkill(self)
    end,
    on_cost = function(self, event, target, player, data)
        return true
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local targets = room:getAlivePlayers(true)
        for _,p in ipairs(targets) do
            if not p:isNude()  and not p.dead and player:hasSkill(self) and player:isWounded() then
                local  card = room:askForDiscard(p, 1, player:getLostHp(), true, self.name, true, "slash", "#wojianyoulian-discard:"..player.id)
                room:recover({
                    who = player,
                    num = #card,
                    recoverBy =player ,
                    skillName = self.name
                })
            end
        end
    end
})

Fk:loadTranslationTable {
    ["mcdh_wojianyoulian"] = "我见犹怜",
    [":mcdh_wojianyoulian"] = "当你进入濒死状态时，所有角色可以依次弃置任意张【杀】，令你回复等量体力。",
    ["#wojianyoulian-discard"] = "我见犹怜:弃置任意张【杀】，令 %src 回复等量体力。"
}

return wojianyoulian